package com.my.ddd_sample_collections.aggregate_change_tracking.repository_framework;

import lombok.Getter;

import java.util.Objects;

@Getter
public class DeletedDomainObjectKey {
    private final DomainObject parent;
    private final String propertyName;
    
    public DeletedDomainObjectKey(DomainObject parent, String propertyName) {
        this.parent = parent;
        this.propertyName = propertyName;
    }
    
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        DeletedDomainObjectKey that = (DeletedDomainObjectKey) o;
        return Objects.equals(parent, that.parent) && Objects.equals(propertyName, that.propertyName);
    }
    
    @Override
    public int hashCode() {
        return Objects.hash(parent, propertyName);
    }
}
